# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=zlib
pkgver=1.3
pkgrel=2
pkgdesc="A compression/decompression Library"
arch="all"
license="Zlib"
url="https://zlib.net/"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="https://zlib.net/fossils/zlib-$pkgver.tar.gz
	configure-Pass-LDFLAGS-to-link-tests.patch
	"

# secfixes:
#   1.2.12-r2:
#     - CVE-2022-37434
#   1.2.11-r4:
#     - CVE-2018-25032
#   0:
#     - CVE-2023-45853

build() {
	# we trade size for a little more speed.
	export CFLAGS="$CFLAGS -O2"
	CHOST="$CHOST" ./configure \
		--prefix=/usr \
		--libdir=/lib \
		--shared
	make
}

check() {
	make check
}

package() {
	make install \
		pkgconfigdir="/usr/lib/pkgconfig" \
		DESTDIR="$pkgdir"
}

sha512sums="
185795044461cd78a5545250e06f6efdb0556e8d1bfe44e657b509dd6f00ba8892c8eb3febe65f79ee0b192d6af857f0e0055326d33a881449f3833f92e5f8fb  zlib-1.3.tar.gz
76179eb7e498aef5bc88c3f826c6f2506a2d3c3a2e2560ef1825bd4a9297d68b0d2390619a4b3b0b2e6dde765431e5fba18fd15fbd1ad99827244f8f9bdbd909  configure-Pass-LDFLAGS-to-link-tests.patch
"
